<%@page import="javax.portlet.PortletSession"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
<%@ taglib prefix="portlet" uri="http://java.sun.com/portlet"%>
<%@taglib prefix="theme" uri="http://liferay.com/tld/theme" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@page import="javax.portlet.PortletURL"%>

<portlet:defineObjects/>
<theme:defineObjects/>

<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.6.1.min.js"></script>
<h1>Welcome to our library</h1>

<portlet:renderURL var="updateBookURL">
	<portlet:param name="action" value="insert"/>
</portlet:renderURL>
<portlet:renderURL var="listBooksURL">
	<portlet:param name="action" value="list"/>
</portlet:renderURL>
<portlet:actionURL var="searchBooksURL">
	<portlet:param name="action" value="searchBook"/>
</portlet:actionURL>

<br/><a href="${updateBookURL}">Add new Book &raquo;</a>
<a href="${listBooksURL}">Show all books &raquo;</a>

<br/><h2>Portlet Session Variable: <%= portletSession.getAttribute("HELLO_TOKEN", PortletSession.APPLICATION_SCOPE) %></h2>

<br/><h2>Render Parameter Value: <%= renderRequest.getParameter("HELLO_TO") %></h2>

<label id="sayHelloLabel"></label>
<script type="text/javascript">

AUI().ready("event", "node", function(A){
	Liferay.on("sayHelloEvent", function(event){
		jQuery('#sayHelloLabel').html('Hello my dear, ' + event.helloTo + 	'<br/>');
	});
});
</script>


<form action="<%= searchBooksURL%>"  method="post">
	<table cellpadding="4">
	
		<tr>
			<td>Search Term</td>
			<td><input type="text" name="searchTerm" size="30" maxlength="80"></td>
		</tr>
		<tr>
			<td><input type="submit" value="Search" ></td>
		</tr>
	</table>
</form >

